***REPLICATION: The Distributive Politics of Privately Financed Infrastructure Agreements
*DR ELEANOR FLORENCE WOODHOUSE
*SEPTEMBER 2023 


***SET-UP

use "~/Downloads/replication_PFIAs.dta", clear 
xtset d_id elec_yr 


***DESC STATS

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust

*TABLE 1
sutex2 ppp in_power new_margin elec_yr if e(sample), ///
varlabels minmax digits(3)   ///  
saving(sumstats1.tex) replace

*TABLE 2	
sutex2 visible invisible intl if e(sample), ///
varlabels minmax digits(3)   ///  
saving(sumstats2.tex) replace


***RESULTS 

*TABLE 3
reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust  
outreg2 using MAIN, tex replace ctitle ("Main") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

reg visible i.in_power##c.new_margin i.d_id elec_yr, robust  //visible
outreg2 using MAIN, tex append ctitle ("Visible Sector") keep(visible i.in_power##c.new_margin)  label addtext(District FE, YES) 

reg invisible i.in_power##c.new_margin i.d_id elec_yr, robust  //invisible 
outreg2 using MAIN, tex append ctitle ("Invisible Sector") keep(invisible i.in_power##c.new_margin)  label addtext(District FE, YES) 

reg intl i.in_power##c.new_margin i.d_id elec_yr, robust //international 
outreg2 using MAIN, tex append ctitle ("International") keep(intl i.in_power##c.new_margin)  label addtext(District FE, YES) 


***INTERPRETATION 

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust 
margins, at(in_power=(0 1) new_margin=(0.01 0.23)) //0.23 = 75th percentile 


***GRAPHING 

*FIGURE 1
twoway histogram new_margin || kdensity new_margin, scheme(plotplain)

*FIGURE 2
reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust 
margins, at(in_power=(0 1) new_margin=(0.01 0.23)) //0.23 = 75th percentile 
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot))

*FIGURE 3
reg visible i.in_power##c.new_margin i.d_id elec_yr, robust //visible
margins, at(in_power=(0 1) new_margin=(0.01 0.23)) 
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot)) name(visible, replace)

reg invisible i.in_power##c.new_margin i.d_id elec_yr, robust //invisible
margins, at(in_power=(0 1) new_margin=(0.01 0.23)) 
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot)) name(invisible, replace)

gr combine visible invisible 


***ROBUSTNESS (APPENDIX)

*TABLE A2
logit ppp i.in_power##c.new_margin i.d_id elec_yr  
outreg2 using ROB, tex replace ctitle ("Logit") keep(ppp i.in_power##c.new_margin) label addtext(Distict FE, YES)

reg ppp i.in_power##c.new_margin i.cntry elec_yr, robust
outreg2 using ROB, tex append ctitle ("Cntry FE") keep(ppp i.in_power##c.new_margin) label addtext(Country FE, YES)

fp generate new_margin^(2 3 4) //generate polynomials

reg ppp i.in_power i.in_power##c.new_margin_1 i.d_id elec_yr, r
outreg2 using ROB, tex append ctitle ("Poly2") keep(ppp i.in_power##c.new_margin_1) label addtext(District FE, YES)

reg ppp i.in_power i.in_power##c.new_margin_2 i.d_id elec_yr, r
outreg2 using ROB, tex append ctitle ("Poly3") keep(ppp i.in_power##c.new_margin_2) label addtext(District FE, YES)

reg ppp i.in_power i.in_power##c.new_margin_3 i.d_id elec_yr, r
outreg2 using ROB, tex append ctitle ("Poly4") keep(ppp i.in_power##c.new_margin_3) label addtext(District FE, YES)

drop new_margin_1 new_margin_2 new_margin_3

*FIGURE A1
reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust 
margins, at(in_power=(0 1) new_margin=(0.01 0.14)) //0.14 = mean 
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot)) name(rob1, replace)

margins, at(in_power=(0 1) new_margin=(0.01 0.33)) //0.33 = 90th percentile 
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot)) name(rob2, replace)

margins, at(in_power=(0 1) new_margin=(0.001 0.23)) //0.001 = 1st percentile 
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot)) name(rob3, replace)

margins, at(in_power=(0 1) new_margin=(0.006 0.23)) //0.006 = 5th percentile
marginsplot, scheme(plotplain) plot1opts(lpattern(dash_dot))  plot2opts(lpattern(dot)) name(rob4, replace)

graph combine rob1 rob2 rob3 rob4

*TABLE A3
bysort cntry elec_yr: egen press_free = max(rsf_pfi)

gen press_hi = 0
replace press_hi = 1 if press_free > 17 //mean

gen press_lo = 0
replace press_lo = 1 if press_free < 17

preserve

keep if press_hi == 1

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust
outreg2 using RR, tex replace ctitle ("Free Press: High") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

restore 

preserve

keep if press_lo == 1

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust
outreg2 using RR, tex append ctitle ("Free Press: Low") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

restore 

bysort cntry elec_yr: egen civil_lib = max(fh_cl)

gen cvl_lib_hi = 0
replace cvl_lib_hi = 1 if civil_lib < 3

gen cvl_lib_lo = 0
replace cvl_lib_lo = 1 if civil_lib > 3

preserve

keep if cvl_lib_hi == 1 

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust
outreg2 using RR, tex append ctitle ("Civil Liberties: High") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

restore 

preserve

keep if cvl_lib_lo == 1 

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust
outreg2 using RR, tex append ctitle ("Civil Liberties: Low") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

restore 

bysort cntry elec_yr: egen elec_demo = max(vdem_polyarchy) 

gen elec_dem_hi = 0
replace elec_dem_hi = 1 if elec_demo > 0.7 //mean

gen elec_dem_lo = 0
replace elec_dem_lo = 1 if elec_demo < 0.7

preserve

keep if elec_dem_hi == 1 

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust
outreg2 using RR, tex append ctitle ("Elec. Competition: High") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

restore 

preserve

keep if elec_dem_lo == 1 

reg ppp i.in_power##c.new_margin i.d_id elec_yr, robust 
outreg2 using RR, tex append ctitle ("Elec. Competition: Low") keep(ppp i.in_power##c.new_margin)  label addtext(District FE, YES)

restore 

*TABLE A4 
reg ppp i.in_power##c.new_margin elec_yr v11_new, robust //FDI 
outreg2 using RR2, tex append ctitle ("FDI 1") keep(ppp i.in_power##c.new_margin v11_new) 

reg ppp i.in_power##c.new_margin elec_yr v12_new, robust //FDI 
outreg2 using RR2, tex append ctitle ("FDI 2") keep(ppp i.in_power##c.new_margin v12_new) 

reg ppp i.in_power##c.new_margin elec_yr v7_new, robust //private involvement 
outreg2 using RR2, tex append ctitle ("Priv. Invest. 1") keep(ppp i.in_power##c.new_margin v7_new) 

reg ppp i.in_power##c.new_margin elec_yr v8_new, robust //private involvement 
outreg2 using RR2, tex append ctitle ("Priv. Invest. 2") keep(ppp i.in_power##c.new_margin v8_new) 

reg ppp i.in_power##c.new_margin elec_yr v9_new, robust //private involvement 
outreg2 using RR2, tex append ctitle ("Priv. Invest. 3") keep(ppp i.in_power##c.new_margin v9_new) 

reg ppp i.in_power##c.new_margin elec_yr v10_new, robust //private involvement 
outreg2 using RR2, tex append ctitle ("Priv. Invest. 4") keep(ppp i.in_power##c.new_margin v10_new) 

reg ppp i.in_power##c.new_margin elec_yr v5_new, robust //gdp
outreg2 using RR2, tex append ctitle ("GDP 1") keep(ppp i.in_power##c.new_margin v5_new) 

reg ppp i.in_power##c.new_margin elec_yr v6_new, robust //gdp
outreg2 using RR2, tex append ctitle ("GDP 2") keep(ppp i.in_power##c.new_margin v6_new) 

reg ppp i.in_power##c.new_margin elec_yr v1_new, robust //education
outreg2 using RR2, tex append ctitle ("Edu. 1") keep(ppp i.in_power##c.new_margin v1_new) 

reg ppp i.in_power##c.new_margin elec_yr v2_new, robust //education
outreg2 using RR2, tex append ctitle ("Edu. 2") keep(ppp i.in_power##c.new_margin v2_new) 

reg ppp i.in_power##c.new_margin elec_yr v3_new, robust //education
outreg2 using RR2, tex append ctitle ("Edu. 3") keep(ppp i.in_power##c.new_margin v3_new) 

reg ppp i.in_power##c.new_margin elec_yr v4_new, robust //education
outreg2 using RR2, tex append ctitle ("Edu. 4") keep(ppp i.in_power##c.new_margin v4_new) 


